home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.awt;
-
- import java.awt.Canvas;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Rectangle;
-
- public class Label3D extends Canvas implements AlignStyle, BevelStyle {
- public static final int INDENT_ZERO = 0;
- public static final int INDENT_ONE = 1;
- public static final int INDENT_TWO = 2;
- protected String sLabel3D;
- private int alignStyle;
- private int bevelStyle;
- private Color color1;
- private Color color2;
- private Color textColor;
- private Color borderedColor;
- // $FF: renamed from: fm java.awt.FontMetrics
- private FontMetrics field_0;
- private int xTemp;
- private int yTemp;
- private int indent;
- private boolean bOsFlag;
-
- public Label3D() {
- this("", 1, 1, Color.black, 0);
- }
-
- public Label3D(String var1, int var2, int var3) {
- this(var1, var2, var3, Color.black, 0);
- }
-
- public Label3D(String var1, int var2, int var3, Color var4) {
- this(var1, var2, var3, var4, 0);
- }
-
- public Label3D(String var1, int var2, int var3, int var4) {
- this(var1, var2, var3, Color.black, var4);
- }
-
- public Label3D(String var1, int var2, int var3, Color var4, int var5) {
- this.bOsFlag = false;
- String var6 = System.getProperty("os.name");
- if (!var6.startsWith("S") && !var6.startsWith("OSF")) {
- this.bOsFlag = false;
- } else {
- this.bOsFlag = true;
- ((Component)this).setFont(new Font("Dialog", 0, 10));
- }
-
- this.sLabel3D = var1;
- this.textColor = var4;
- this.borderedColor = Color.black;
- this.setBorderIndent(var5, false);
- this.setAlignStyle(var2);
- this.setBevelStyle(var3);
- }
-
- public void setAlignStyle(int var1) {
- this.alignStyle = var1;
- ((Component)this).invalidate();
- }
-
- public int getAlignStyle() {
- return this.alignStyle;
- }
-
- public void setBevelStyle(int var1) {
- this.bevelStyle = var1;
- switch (var1) {
- case 0:
- this.color1 = Color.black;
- this.color2 = Color.white;
- break;
- case 1:
- this.color1 = Color.white;
- this.color2 = Color.black;
- break;
- case 2:
- this.color1 = this.borderedColor;
- this.color2 = this.borderedColor;
- break;
- default:
- this.color1 = this.color2 = null;
- }
-
- ((Component)this).invalidate();
- }
-
- public int getBevelStyle() {
- return this.bevelStyle;
- }
-
- public void setBorderIndent(int var1) {
- this.setBorderIndent(var1, true);
- }
-
- public int getBorderIndent() {
- return this.indent;
- }
-
- public void setBorderedColor(Color var1) {
- this.borderedColor = var1;
- if (this.bevelStyle == 2) {
- this.color1 = var1;
- this.color2 = var1;
- }
-
- ((Component)this).invalidate();
- }
-
- public void setText(String var1) {
- this.sLabel3D = var1;
- ((Component)this).repaint();
- }
-
- public String getText() {
- return this.sLabel3D;
- }
-
- public void setTextColor(Color var1) {
- this.textColor = var1;
- ((Component)this).invalidate();
- }
-
- public Color getTextColor() {
- return this.textColor;
- }
-
- public void paint(Graphics var1) {
- Rectangle var2 = ((Component)this).bounds();
- Color var3 = var1.getColor();
- var1.setColor(((Component)this).getBackground());
- var1.fillRect(0, 0, var2.width - 1, var2.height - 1);
- if (this.color1 != null) {
- var1.clipRect(0, 0, var2.width, var2.height);
- var1.setColor(this.color1);
- var1.drawLine(1 + this.indent, this.indent, var2.width - 3 - this.indent, this.indent);
- var1.setColor(this.color2);
- var1.drawLine(1 + this.indent, var2.height - 1 - this.indent, var2.width - 3 - this.indent, var2.height - 1 - this.indent);
- var1.setColor(this.color1);
- var1.drawLine(this.indent, this.indent, this.indent, var2.height - 1 - this.indent);
- var1.setColor(this.color2);
- var1.drawLine(var2.width - 2 - this.indent, this.indent, var2.width - 2 - this.indent, var2.height - 1 - this.indent);
- var1.clipRect(2 + this.indent, 1 + this.indent, var2.width - 9 - this.indent, var2.height - 4 - this.indent);
- this.yTemp = 1 + this.indent;
- } else {
- var1.drawRect(this.indent, this.indent, var2.width - 2 - this.indent, var2.height - 1 - this.indent);
- var1.clipRect(2, 1, var2.width - 7, var2.height - 2);
- this.yTemp = 1;
- }
-
- var1.setColor(this.textColor);
- this.field_0 = ((Component)this).getFontMetrics(((Component)this).getFont());
- this.yTemp = (var2.height - this.yTemp + this.field_0.getAscent()) / 2;
- switch (this.alignStyle) {
- case 0:
- if (this.bevelStyle == 2) {
- var1.drawString(this.sLabel3D, 4, this.yTemp);
- } else {
- var1.drawString(this.sLabel3D, 8, this.yTemp);
- }
- break;
- case 1:
- this.xTemp = (var2.width - this.field_0.stringWidth(this.sLabel3D)) / 2;
- var1.drawString(this.sLabel3D, this.xTemp, this.yTemp);
- break;
- case 2:
- this.xTemp = var2.width - this.field_0.stringWidth(this.sLabel3D);
- if (this.bevelStyle == 2) {
- var1.drawString(this.sLabel3D, this.xTemp - 6, this.yTemp);
- } else {
- var1.drawString(this.sLabel3D, this.xTemp - 10, this.yTemp);
- }
- }
-
- var1.setColor(var3);
- }
-
- public Dimension preferredSize() {
- Dimension var1 = ((Component)this).size();
- Dimension var2 = this.minimumSize();
- return new Dimension(Math.max(var1.width, var2.width), Math.max(var1.height, var2.height));
- }
-
- public Dimension minimumSize() {
- Dimension var1 = new Dimension(18, 10);
- Font var2 = ((Component)this).getFont();
- if (var2 == null) {
- if (this.bOsFlag) {
- var1.height = 29;
- }
- } else {
- this.field_0 = ((Component)this).getFontMetrics(var2);
- var1.width = this.field_0.stringWidth(this.sLabel3D) + 18;
- var1.height = this.field_0.getHeight() + 10;
- if (this.bOsFlag && var1.height < 29) {
- var1.height = 29;
- }
- }
-
- return var1;
- }
-
- public synchronized void reshape(int var1, int var2, int var3, int var4) {
- super.reshape(var1, var2, var3, var4);
- if (!((Component)this).isValid()) {
- ((Component)this).repaint();
- }
-
- }
-
- private void setBorderIndent(int var1, boolean var2) {
- if (var1 < 0) {
- this.indent = 0;
- } else if (var1 > 2) {
- this.indent = 2;
- } else {
- this.indent = var1;
- }
-
- if (var2) {
- ((Component)this).repaint();
- }
-
- }
- }
-